# coding: utf-8

# Copyright (c) P SOFTHOUSE. All rights reserved.

import maya.cmds as cmds
#import maya.mel



def getMayaVersion():
    version = cmds.about(f=True)
    return int(float(version[:4]))


renderer_args = [
'addGlobalsNode',
#'addGlobalsTab',
'batchRenderOptionsProcedure',
'batchRenderOptionsStringProcedure',
'batchRenderProcedure',
'cancelBatchRenderProcedure',
'changeIprRegionProcedure',
'commandRenderProcedure',
#'exists',
'globalsNodes',
'globalsTabCreateProcNames',
'globalsTabLabels',
'globalsTabUpdateProcNames',
'iprOptionsMenuLabel',
'iprOptionsProcedure',
'iprOptionsSubMenuProcedure',
'iprRenderProcedure',
'iprRenderSubMenuProcedure',
'isRunningIprProcedure',
'logoCallbackProcedure',
'logoImageName',
#'materialViewRendererList',
#'materialViewRendererPause',
#'materialViewRendererSuspend',
#'namesOfAvailableRenderers',
'pauseIprRenderProcedure',
'polyPrelightProcedure',
'refreshIprRenderProcedure',
'renderDiagnosticsProcedure',
#'renderGlobalsProcedure',
#'renderMenuProcedure',
'renderOptionsProcedure',
'renderProcedure',
'renderRegionProcedure',
#'renderSequenceProcedure',
'rendererUIName',
'renderingEditorsSubMenuProcedure',
'showBatchRenderLogProcedure',
'showBatchRenderProcedure',
'showRenderLogProcedure',
'startIprRenderProcedure',
'stopIprRenderProcedure',
'textureBakingProcedure',
#'unregisterRenderer',
]

if getMayaVersion() >= 2017:
    renderer_args.append('renderSequenceProcedure')

if getMayaVersion() >= 2019:
    renderer_args.append('supportColorManagement')


def all_renderer_info():
    renderer_info(cmds.renderer(q=True, namesOfAvailableRenderers=True))

def renderer_info(renderer_names):
    if not isinstance(renderer_names, (list, tuple)):
        renderer_names = [renderer_names]

    for renderer_name in renderer_names:
        print '----------------------------------------------------------------------- '
        print renderer_name
        print '----------------------------------------------------------------------- '
        for arg in renderer_args:
            ret = eval('cmds.renderer(renderer_name, q=True, {}=True)'.format(arg))
            print u'{} = {}'.format(arg, ret)
